package com.lzw.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzw.pojo.OperateLog;
import com.lzw.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/Log")
@CrossOrigin(origins = "http://localhost:7070")
public class LogController {

    @Autowired
    private LogService logService;

    @GetMapping("/list")
    public PageInfo<OperateLog> list(
            @RequestParam(defaultValue = "1") Integer pageNumber,
            @RequestParam(defaultValue = "10") Integer pageSize,
            String operateUser){
        PageHelper.startPage(pageNumber,pageSize);
        List<OperateLog> list = logService.list(pageNumber,pageSize,operateUser);
        return new PageInfo<>(list);
    }
}
